#include <time.h>
#include <sys/timeb.h>
#include <windows.h>
#include "getdaytime.h"

int gettimeofday(struct timeval* tp, int* tz) 
{
	LARGE_INTEGER tickNow;
	LARGE_INTEGER tickFrequency;
	int tickFrequencySet = 0;
	if (tickFrequencySet == 0)
	{
		QueryPerformanceFrequency(&tickFrequency);
		tickFrequencySet = 1;
	}
	QueryPerformanceCounter(&tickNow);
	tp->tv_sec = (long) (tickNow.QuadPart / tickFrequency.QuadPart);
	tp->tv_usec = (long) (((tickNow.QuadPart % tickFrequency.QuadPart) * 1000000L) / tickFrequency.QuadPart);

	return 0;
}
